package com.zyx.income.tax.service;

import com.zyx.income.tax.entity.IncomeTax;
import org.kie.api.KieBase;
import org.kie.api.runtime.KieSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zyx
 * @since 2022/7/10 07:30
 * desc: 调用规则引擎，执行规则
 */
@Service
public class RuleService {
    @Autowired
    private KieBase kieBase;

    public IncomeTax incomeTax(IncomeTax incomeTax) {
        KieSession kieSession = kieBase.newKieSession();
        kieSession.insert(incomeTax);
        kieSession.fireAllRules();
        kieSession.dispose();
        return incomeTax;
    }

}
